<?php

namespace App\Model\Report;

use App\Model\Model;

/**
 * @property int $id
 * @property int $project_id
 * @property int $app_id
 * @property string $oaid
 * @property string $ua
 * @property string $ip
 * @property int $channel_type
 * @property string $channel
 * @property int $is_ascribe_store
 * @property string $ad_id
 * @property string $ad_name
 * @property string $plan_id
 * @property string $plan_name
 * @property string $report_config
 * @property int $sub_device_id
 * @property string $ascribe_time
 * @property string $create_time
 * @property string $update_time
 */
class BigDevice extends Model
{
    protected ?string $table = "big_device";

    protected array $casts = ['id' => 'integer', 'project_id' => 'integer', 'app_id' => 'integer', 'channel_type' => 'integer', 'is_ascribe_store' => 'integer', 'sub_device_id' => 'integer'];

    public static function findDevice($appId, $oaid)
    {
        if (!$oaid) {
            return null;
        }

        return self::query()->where("app_id", $appId)->where("oaid", $oaid)->first();
    }
}